package jjoms.model.board;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class BoardDAOImpl implements BoardDAO {
	@Resource(name="sqlSessionTemplate")
	   private SqlSessionTemplate sqlSessionTemplate;   
	@Override
	public void register(BoardVO bvo) {
		sqlSessionTemplate.insert("board.register",bvo);
	}
	@Override
	public BoardVO showcontent(int no) {
		return sqlSessionTemplate.selectOne("board.showcontent",no);
	}
	@Override
	public List<BoardVO> getboardlist(String pageNo) {
		int pNo = Integer.parseInt(pageNo);
		System.out.println("pNO"+pNo);
		return sqlSessionTemplate.selectList("board.getboardlist",pageNo);
	}
	@Override
	public void update(BoardVO vo) {
		sqlSessionTemplate.update("board.update",vo);
	}
@Override
	public void delete(int no) {
	sqlSessionTemplate.delete("board.delete",no);		
	}
@Override
public int totalContent() {
	return sqlSessionTemplate.selectOne("board.totalContent");
}
@Override
public void coment(ComentVO cvo) {
	sqlSessionTemplate.insert("board.coment",cvo);
	
}
@Override
public List<ComentVO> comentview(int no) {
	return sqlSessionTemplate.selectList("board.comentview",no);
}
@Override
public int getComentCount(int boardNO) {
	// TODO Auto-generated method stub
	return sqlSessionTemplate.selectOne("board.getComentCount",boardNO);
}
@Override
public void noCountComent(ComentVO cvo) {
	sqlSessionTemplate.insert("board.noCountComent",cvo);
}
@Override
public void updateCount(int no) {
	 sqlSessionTemplate.update("board.updateCount",no);
	
}
@Override
public void managerRegister(BoardVO bvo) {
		sqlSessionTemplate.insert("board.managerRegister",bvo);
	}
}

